#region Using

using System;
using System.Collections.Generic;
using BlogEngine.Core;
using BlogEngine.Core.Provider.Interfaces;

#endregion

namespace BlogEngine.Core.Provider.LocalFileSystem
{
	/// <summary>
	/// A storage provider for BlogEngine that uses XML files.
	/// <remarks>
	/// To build another provider, you can just copy and modify
	/// this one. Then add it to the web.config's BlogEngine section.
	/// </remarks>
	/// </summary>
	public class Provider : BlogProviderBase
	{
		private static string _folder = string.Empty;

		/// <summary>
		/// Gets the folder name.
		/// </summary>
		/// <value>The folder.</value>
		public static string Folder
		{
			get
			{
				if (string.IsNullOrEmpty(_folder))
				{
					_folder = System.Web.HttpContext.Current.Server.MapPath(System.IO.Path.Combine(BlogSettings.Instance.StorageLocation, "files"));
					_folder = System.IO.Path.Combine(_folder, "photos");
				}

				return _folder;
			}
		}

		public Provider()
		{
			// TODO: use reflection to find and register the interfaces with their concrete implementations
			Register(typeof(IPhotoStorage), new CIPhotoStorage());
		
		}

	}
}
